<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AllProduct.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<link href="<%=path%>/css/mine.css" type="text/css" rel="stylesheet">
    <link href="<%=path%>/css/custom.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="<%=path%>/js/jquery-1.6.2.min.js"></script>
 <script type="text/javascript">
  
 $(function() {
	    $('#checkData').click(function(){
		    var productid=$('#search_text1').val();
		    var CNameB=$('#search_text3').val();
		    var CName=$('#search_text4').val();
		    var opt="id";
			$(location).attr('href','<%=path%>/Product_queryByCond?productid='+ productid+'&CNameB='+CNameB+'&opt='+opt+'&CName='+CName);
		  });
	
	    
	    $('#search_text1').click(function() {
	    	    $("#radio1").attr("checked", true);
			    $("#radio3").attr("checked", false);
			    $("#radio4").attr("checked", false);
		  });
	    $('#search_text3').click(function() {
 	       $("#radio1").attr("checked", false);
		    $("#radio3").attr("checked", true);
		    $("#radio4").attr("checked", false);
	  });  
	    $('#search_text4').click(function() {
 	    $("#radio1").attr("checked", false);
		    $("#radio3").attr("checked", false);
		    $("#radio4").attr("checked", true);
	  });
	    $('#checkData2').click(function(){
	    	var productid=$('#search_text1').val();
		    var CNameB=$('#search_text3').val();
		    var CName=$('#search_text4').val();
		    var opt="nameB";
		    $(location).attr('href','<%=path%>/Product_queryByCond?productid='+ productid+'&CNameB='+CNameB+'&opt='+opt+'&CName='+CName);
		  });
	    
	    $('#checkData3').click(function(){
	    	var productid=$('#search_text1').val();
		    var CNameB=$('#search_text3').val();
		    var CName=$('#search_text4').val();
		    var opt="name";
		    $(location).attr('href','<%=path%>/Product_queryByCond?productid='+ productid+'&CNameB='+CNameB+'&opt='+opt+'&CName='+CName);
		  });
	    
		 
		  });
 
 
 function modify(value) {
		$(location).attr('href','<%=path%>/Product_ModifyProduct?productid='+value);
     }
  function deltr(opp,value) {
	    alert(value);
	     $.ajax({
				cache: true,
				type: "POST",
				url:'<%=path%>/Product_deleteProduct?productid='+ value,	 
				async: false,
				error: function(request) {
				alert("发送请求失败！"+request.responseText);
				},
				success: function(data) {
					$(location).attr('href','<%=path%>/Product_AllProduct');
				}
				});
	    
		$(opp).parent().parent().remove();//移除当前行
		}
  </script>
  </head>
  <s:action name="Product_QueryType1"  namespace="/"></s:action>
  <s:action name="Product_AddProduct"  namespace="/"></s:action>
  <body>
  <div class="div_head">
		<span> <span style="float:left">当前位置是：产品管理 》 管理产品</span> <span
			style="float:right;margin-right: 8px;font-weight: bold"> <a
				style="text-decoration: none" href="./admin.php?c=goods&a=showlist">【主页】</a>
		</span>
		</span>
	</div>
  <div>
  <div>
  <table id="kk" cellSpacing="0" cellPadding="0" align="center"
		border="0" style="width:100%;">

		<tr>
			<td colspan="6">
				<div id="sercherDiv">
					<div id="search">
					    <input type="radio" id="radio1"  > 
						<label for="search_text">编号:</label>
						<input type="text" style="width:200px;" id="search_text1" name="search_text1" /> <input type="button" id="checkData" value="查询" />
					    <input type="radio" id="radio3"  > 
						<label for="search_text2"> 产品二级种类: </label>
						 <select name="search_text3" id="search_text3">
		                  <option selected="selected" >请选择二级类型</option>
		                  <s:iterator value="#request.protype " var="p">
		                  <option >${p.CName}</option>
                           </s:iterator>
		                  </select>
						 <input type="button" id="checkData2" value="查询" />
					    <input type="radio" id="radio4"  > 
						<label for="search_text3"> 产品名称: </label>
						<input type="text" style="width:200px;" id="search_text4" name="search_text4" /> <input type="button" id="checkData3" value="查询" />
					</div>
				</div>
				</td>
		</tr>
 </table>
  </div>
  <table class="table_a" cellSpacing="0" cellPadding="2"
		width="100%" bgColor="#ffffff" border="2">
  <tr>

			<th scope="col" abbr="Dual 1.8">编号</th>
			<th scope="col" abbr="Dual 1.8">产品一级种类</th>
			<th scope="col" abbr="Dual 1.8">产品二级种类</th>
			<th scope="col" abbr="Dual 1.8">产品名称</th>
			<th scope="col" abbr="Dual 1.8">简介</th>
			<th scope="col" abbr="Dual 1.8">价格</th>
			<th scope="col" abbr="Dual 1.8">创建人</th>
			<th scope="col" abbr="Dual 1.8">创建时间</th>
			<th scope="col" abbr="Dual 1.8">修改人</th>
			<th scope="col" abbr="Dual 1.8">修改时间</th>
			<th scope="col" abbr="Dual 1.8">操作</th>
  </tr>
  <s:iterator value="#request.product" var="d">
			<tr onMouseover="this.style.background='#A020F0'" onmouseout ="this.style.background=''">
				<td align="center">${d.CId }</td>
				<td align="center">${d.CNameA }</td>
				<td align="center">${d.CNameB }</td>
				<td align="center">${d.CName }</td>
				<td align="center">${d.CIntro }</td>
				<%-- <td align="center">${request.CDescription }</td> --%>
				<td align="center">${d.CPrice }</td>
				<td align="center">${d.CCreator }</td>
				<td align="center"><s:date  name="#d.CCreatetime" format="yyyy-MM-dd hh:mm:ss"/></td>
				<td align="center">${d.CModifier }</td>
				<td align="center"><s:date  name="#d.CModifytime" format="yyyy-MM-dd hh:mm:ss"/></td>
				<td align="center">
				<a id="edit" href="javascript:modify('${d.CId }')">修改
				</a><a id="delete" href="javascript:deltr(this,'${d.CId }')">删除</a>
				</td>
			</tr>
  </s:iterator>
  </table>
  </div>
  <div align="center">

		<a href="<%=path%>/Product_AllProduct?currentPage=1">首页</a>
		<s:if test="#request.page.hasPrePage">
			<a
				href="<%=path%>/Product_AllProduct?currentPage=${page.currentPage-1 }">上一页</a>
		</s:if>

		<s:if test="#request.page.hasNextPage">
			<a
				href="<%=path%>/Product_AllProduct?currentPage=${page.currentPage+1 }">下一页</a>
		</s:if>

		<a href="<%=path%>/Product_AllProduct?currentPage=${page.totalPage }">尾页</a>

		<span>当前为第${page.currentPage}页,共${page.totalPage
			}页,共${page.totalCount }总记录</span>

	</div>
  </body>
</html>
